package servlet;

import hadoop.hadoopUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Chang
 * @date 2021/11/29 16:24
 */
public class servletA extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
//        获得两个参数的内容
        String srcPath = req.getParameter("srcPath");
        String destPath = req.getParameter("destPath");
//        new 一个hadoop 的工具类
        hadoopUtil hadoopUtil = new hadoopUtil();
//        开始上传
        String s = hadoopUtil.UpLoad(srcPath, destPath);

//        字符流输出
        resp.setContentType("text/charset=utf-8");
        PrintWriter pw = resp.getWriter();
        pw.write("<h1>"+s);
    }
}
